# !/bin/zsh

git pull

yarn prod

if [[ $? -eq 0 ]]; then
  echo -e "\033[32m Build Successful\033[0m"
else
  exit -1
fi

ssh ubuntu_server "cd /home/ubuntu/workspace/mpa-dance-admin/ && rm -rf ./dist"

if [[ $? -eq 0 ]]; then
  echo -e "\033[32m Remove dist Successful\033[0m"
else
  exit -1
fi

scp -r ~/workspace/mpa-dance-admin/dist ubuntu_server:/home/ubuntu/workspace/mpa-dance-admin/dist

if [[ $? -eq 0 ]]; then
  echo -e "\033[32m Scp Successful\033[0m"
else
  exit -1
fi
